home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / emacs-19.000 / emacs-19 / usr / local / info / emacs-7 < prev    next >
Encoding:
GNU Info File  |  1995-09-11  |  48.2 KB  |  1,131 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.55 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: Editing with VC,  Next: Log Entries,  Prev: VC Concepts,  Up: Version Control
  6.  
  7. Editing with Version Control
  8. ----------------------------
  9.  
  10.    These are the commands for editing a file maintained with version
  11. control:
  12.  
  13. `C-x C-q'
  14. `C-x v v'
  15.      Check the visited file in or out.
  16.  
  17. `C-x v u'
  18.      Revert the buffer and the file to the last checked in version.
  19.  
  20. `C-x v c'
  21.      Remove the last-entered change from the master for the visited
  22.      file.  This undoes your last check-in.
  23.  
  24. `C-x v i'
  25.      Register the visited file for version control.
  26.  
  27. (`C-x v' is the prefix key for version control commands; all of these
  28. commands except for `C-x C-q' start with `C-x v'.)
  29.  
  30. * Menu:
  31.  
  32. * Check-Out::                   Checking out a file so you can edit it.
  33. * Check-In::                    After you edit, you check in your changes
  34.                                   to make a new version.
  35. * Version Control Undo::        Canceling changes before or after checkin.
  36. * Registering::                 How to start using version control
  37.                                   for a file.
  38. * VC Mode Line::                Mode line indicates version and lock status.
  39. * CVS and VC::                  Checkout and checkin work differently in CVS.
  40.  
  41. 
  42. File: emacs,  Node: Check-Out,  Next: Check-In,  Up: Editing with VC
  43.  
  44. Check-Out
  45. .........
  46.  
  47.    When you want to modify a file maintained with version control, type
  48. `C-x C-q' (`vc-toggle-read-only').  This "checks out" the file, and
  49. tells RCS or SCCS to lock the file.  This means making the file
  50. writable for you (but not for anyone else).
  51.  
  52.    If you specify a prefix argument (`C-u C-x C-q') for checkout, Emacs
  53. asks you for a version number, and checks out that version *unlocked*.
  54. This lets you move to old versions, or existing branches of the file
  55. (*note Branches::.).  You can then start editing the selected version
  56. by typing `C-x C-q' again.  (If you edit an old version of a file this
  57. way, checking it in again creates a new branch.)
  58.  
  59. 
  60. File: emacs,  Node: Check-In,  Next: Version Control Undo,  Prev: Check-Out,  Up: Editing with VC
  61.  
  62. Check-In
  63. ........
  64.  
  65.    When you are finished editing the file, type `C-x C-q' again.  When
  66. used on a file that is checked out, this command checks the file in.
  67. But check-in does not start immediately; first, you must enter the "log
  68. entry"--a description of the changes in the new version.  `C-x C-q'
  69. pops up a buffer for you to enter this in.  When you are finished
  70. typing in the log entry, type `C-c C-c' to terminate it; this is when
  71. actual check-in takes place.  *Note Log Entries::.
  72.  
  73.    With RCS and SCCS, a checked-out file is also "locked", which means
  74. it is writable for you, but not for anyone else.  As long as you own
  75. the lock on the file, nobody else can modify it, and nobody can check
  76. in any changes to that particular version.  Checking in your changes
  77. unlocks the file, so that other users can lock it and modify it.
  78.  
  79.    CVS, on the contrary, doesn't have a concept of locking.  The working
  80. files are always modifiable, allowing concurrent development, with
  81. possible conflicts being resolved at check-in time.  *Note CVS and VC::.
  82.  
  83.    To specify the version number for the new version, type `C-u C-x
  84. C-q' to check in a file.  Then Emacs asks you for the new version number
  85. in the minibuffer.  This can be used to create a new "branch" of the
  86. file (*note Branches::.), or to increment the file's major version
  87. number.
  88.  
  89.    It is not impossible to lock a file that someone else has locked.  If
  90. you try to check out a file that is locked, `C-x C-q' asks you whether
  91. you want to "steal the lock."  If you say yes, the file becomes locked
  92. by you, but a message is sent to the person who had formerly locked the
  93. file, to inform him of what has happened.  The mode line indicates that
  94. a file is locked by someone else by displaying the login name of that
  95. person, before the version number.
  96.  
  97. 
  98. File: emacs,  Node: Registering,  Next: VC Mode Line,  Prev: Version Control Undo,  Up: Editing with VC
  99.  
  100. Registering a File for Version Control
  101. ......................................
  102.  
  103. `C-x v i'
  104.      Register the visited file for version control.
  105.  
  106.    You can put any file under version control by simply visiting it, and
  107. then typing `C-x v i' (`vc-register'). After `C-x v i', the file is
  108. unlocked and read-only.  Type `C-x C-q' if you wish to start editing it.
  109.  
  110.    When you register the file, Emacs must choose which version control
  111. system to use for it.  You can specify your choice explicitly by setting
  112. `vc-default-back-end' to `RCS', `CVS' or `SCCS'.  Otherwise, if there
  113. is a subdirectory named `RCS', `SCCS', or `CVS', Emacs uses the
  114. corresponding version control system.  In the absence of any
  115. specification, the default choice is RCS if RCS is installed, otherwise
  116. SCCS.
  117.  
  118.    After registering a file with CVS, you must subsequently commit the
  119. initial version by typing `C-x C-q'.  *Note CVS and VC::.
  120.  
  121.    The initial version number for a newly registered file is 1.1, by
  122. default.  To specify a different number, give `C-x v i' a numeric
  123. argument; then it reads the initial version number using the minibuffer.
  124.  
  125.    If `vc-initial-comment' is non-`nil', `C-x v i' reads an initial
  126. comment (much like a log entry) to describe the purpose of this source
  127. file.
  128.  
  129. 
  130. File: emacs,  Node: Version Control Undo,  Next: Registering,  Prev: Check-In,  Up: Editing with VC
  131.  
  132. Undoing Version Control Actions
  133. ...............................
  134.  
  135. `C-x v u'
  136.      Revert the buffer and the file to the last checked in version.
  137.  
  138. `C-x v c'
  139.      Remove the last-entered change from the master for the visited
  140.      file.  This undoes your last checkin.
  141.  
  142.    If you want to discard your current set of changes and revert to the
  143. last version checked in, use `C-x v u' (`vc-revert-buffer').  This
  144. cancels your last check-out, leaving the file unlocked.  If you want to
  145. make a different set of changes, you must first check the file out
  146. again.  `C-x v u' requires confirmation, unless it sees that you
  147. haven't made any changes since the last checked-in version.
  148.  
  149.    `C-x v u' is also the command to use to unlock a file if you lock it
  150. and then decide not to change it.
  151.  
  152.    You can cancel a change after checking it in, with `C-x v c'
  153. (`vc-cancel-version').  This command discards all record of the most
  154. recent checked in version.  `C-x v c' also offers to revert your work
  155. file and buffer to the previous version (the one that precedes the
  156. version that is deleted).  If you say `no', then the buffer and work
  157. file do not change.
  158.  
  159.    Be careful when invoking `C-x v c', as it is easy to throw away a
  160. lot of work with it.  To help you be careful, this command always
  161. requires confirmation with `yes'.
  162.  
  163. 
  164. File: emacs,  Node: VC Mode Line,  Next: CVS and VC,  Prev: Registering,  Up: Editing with VC
  165.  
  166. The VC Mode Line
  167. ................
  168.  
  169.    When you visit a file that is under version control, the mode line
  170. indicates the current status of the file: the name of the version
  171. control back end system, the locking state, and the version.
  172.  
  173.    The locking state is displayed as a single character, which can be
  174. either `-' or `:'.  `-' means the file is not locked or not modified by
  175. you.  Once you lock the file, the state indicator changes to `:'.  If
  176. the file is locked by someone else, that user's name appears after the
  177. version number.
  178.  
  179.    For example, `RCS-1.3' means you are looking at RCS version 1.3,
  180. which is not locked.  `RCS:1.3' means that you have locked the file,
  181. and possibly already changed it.  `RCS:jim:1.3' means that the file is
  182. locked by jim.
  183.  
  184. 
  185. File: emacs,  Node: CVS and VC,  Prev: VC Mode Line,  Up: Editing with VC
  186.  
  187. Using VC with CVS
  188. .................
  189.  
  190.    In CVS, files are never locked.  Two users can check out the same
  191. file at the same time; each user has a separate copy and can edit it.
  192. Work files are always writable; once you have one, you need not type a
  193. VC command to start editing the file.  You can edit it at any time.
  194.  
  195.    CVS terminology speaks of "committing" a change rather than checking
  196. it in.  But in practical terms they work the same way: Emacs asks you
  197. to type in a log entry, and you finish it with `C-c C-c'.  When using
  198. RCS and SCCS, you normally use `C-x C-q' twice for each change; once
  199. before the change, for checkout, and once after, for checkin.  With
  200. CVS, it's different: you normally use `C-x C-q' just once for each
  201. change, to commit the change when it is done.  The work file remains
  202. writable, so you can begin editing again with no special commands.
  203.  
  204.    When you commit a change in a file, and someone else has committed
  205. another change in the meanwhile, that creates a "conflict".  Then `C-x
  206. C-q' asks you to resolve the conflict and try again.
  207.  
  208.    VC does not provide a way to check out a working copy of an existing
  209. file in the repository.  You have to use the CVS shell commands to do
  210. that.  Once you have a work file, you can start using VC for that file.
  211.  
  212.    You can turn off use of VC for CVS-managed files by setting the
  213. variable `vc-handle-cvs' to `nil'.  If you do this, Emacs treats these
  214. files as if they were not managed, and the VC commands are not
  215. available for them.  You must do all CVS operations manually.
  216.  
  217. 
  218. File: emacs,  Node: Log Entries,  Next: Change Logs and VC,  Prev: Editing with VC,  Up: Version Control
  219.  
  220. Log Entries
  221. -----------
  222.  
  223.    When you're editing an initial comment or log entry for inclusion in
  224. a master file, finish your entry by typing `C-c C-c'.
  225.  
  226. `C-c C-c'
  227.      Finish the comment edit normally (`vc-finish-logentry').  This
  228.      finishes check-in.
  229.  
  230.    To abort check-in, just *don't* type `C-c C-c' in that buffer.  You
  231. can switch buffers and do other editing.  As long as you don't try to
  232. check in another file, the entry you were editing remains in its
  233. buffer, and you can go back to that buffer at any time to complete the
  234. check-in.
  235.  
  236.    If you change several source files for the same reason, it is often
  237. convenient to specify the same log entry for many of the files.  To do
  238. this, use the history of previous log entries.  The commands `M-n',
  239. `M-p', `M-s' and `M-r' for doing this work just like the minibuffer
  240. history commands (except that these versions are used outside the
  241. minibuffer).
  242.  
  243.    Each time you check in a file, the log entry buffer is put into VC
  244. Log mode, which involves running two hooks: `text-mode-hook' and
  245. `vc-log-mode-hook'.  *Note Hooks::.
  246.  
  247. 
  248. File: emacs,  Node: Change Logs and VC,  Next: Old Versions,  Prev: Log Entries,  Up: Version Control
  249.  
  250. Change Logs and VC
  251. ------------------
  252.  
  253.    If you use RCS for a program and also maintain a change log file for
  254. it (*note Change Log::.), you can generate change log entries
  255. automatically from the version control log entries:
  256.  
  257. `C-x v a'
  258.      Visit the current directory's change log file and create new
  259.      entries for versions checked in since the most recent entry in the
  260.      change log file (`vc-update-change-log').
  261.  
  262.      This command works with RCS only; it does not work with CVS or
  263.      SCCS.
  264.  
  265.    For example, suppose the first line of `ChangeLog' is dated 10 April
  266. 1992, and that the only check-in since then was by Nathaniel Bowditch
  267. to `rcs2log' on 8 May 1992 with log text `Ignore log messages that
  268. start with `#'.'.  Then `C-x v a' visits `ChangeLog' and inserts text
  269. like this:
  270.  
  271.      Fri May  8 21:45:00 1992  Nathaniel Bowditch  <nat@apn.org>
  272.      
  273.              * rcs2log: Ignore log messages that start with `#'.
  274.  
  275. You can then edit the new change log entry further as you wish.
  276.  
  277.    Normally, the log entry for file `foo' is displayed as `* foo: TEXT
  278. OF LOG ENTRY'.  The `:' after `foo' is omitted if the text of the log
  279. entry starts with `(FUNCTIONNAME): '.  For example, if the log entry
  280. for `vc.el' is `(vc-do-command): Check call-process status.', then the
  281. text in `ChangeLog' looks like this:
  282.  
  283.      Wed May  6 10:53:00 1992  Nathaniel Bowditch  <nat@apn.org>
  284.      
  285.              * vc.el (vc-do-command): Check call-process status.
  286.  
  287.    When `C-x v a' adds several change log entries at once, it groups
  288. related log entries together if they all are checked in by the same
  289. author at nearly the same time.  If the log entries for several such
  290. files all have the same text, it coalesces them into a single entry.
  291. For example, suppose the most recent checkins have the following log
  292. entries:
  293.  
  294. * For `vc.texinfo': `Fix expansion typos.'
  295. * For `vc.el': `Don't call expand-file-name.'
  296. * For `vc-hooks.el': `Don't call expand-file-name.'
  297.  
  298. They appear like this in `ChangeLog':
  299.  
  300.      Wed Apr  1 08:57:59 1992  Nathaniel Bowditch  <nat@apn.org>
  301.      
  302.              * vc.texinfo: Fix expansion typos.
  303.      
  304.              * vc.el, vc-hooks.el: Don't call expand-file-name.
  305.  
  306.    Normally, `C-x v a' separates log entries by a blank line, but you
  307. can mark several related log entries to be clumped together (without an
  308. intervening blank line) by starting the text of each related log entry
  309. with a label of the form `{CLUMPNAME} '.  The label itself is not
  310. copied to `ChangeLog'.  For example, suppose the log entries are:
  311.  
  312. * For `vc.texinfo': `{expand} Fix expansion typos.'
  313. * For `vc.el': `{expand} Don't call expand-file-name.'
  314. * For `vc-hooks.el': `{expand} Don't call expand-file-name.'
  315.  
  316. Then the text in `ChangeLog' looks like this:
  317.  
  318.      Wed Apr  1 08:57:59 1992  Nathaniel Bowditch  <nat@apn.org>
  319.      
  320.              * vc.texinfo: Fix expansion typos.
  321.              * vc.el, vc-hooks.el: Don't call expand-file-name.
  322.  
  323.    A log entry whose text begins with `#' is not copied to `ChangeLog'.
  324. For example, if you merely fix some misspellings in comments, you can
  325. log the change with an entry beginning with `#' to avoid putting such
  326. trivia into `ChangeLog'.
  327.  
  328. 
  329. File: emacs,  Node: Old Versions,  Next: Branches,  Prev: Change Logs and VC,  Up: Version Control
  330.  
  331. Examining And Comparing Old Versions
  332. ------------------------------------
  333.  
  334. `C-u C-x C-q VERSION RET'
  335.      Select version VERSION as the current work file version.
  336.  
  337. `C-x v ~ VERSION RET'
  338.      Examine version VERSION of the visited file, in a buffer of its
  339.      own.
  340.  
  341. `C-x v ='
  342.      Compare the current buffer contents with the latest checked-in
  343.      version of the file.
  344.  
  345. `C-u C-x v = FILE RET OLDVERS RET NEWVERS RET'
  346.      Compare the specified two versions of FILE.
  347.  
  348.    There are two ways to work with an old version of a file.  You can
  349. make the old version your current work file, for example if you want to
  350. reproduce a former stage of development, or if you want to create a
  351. branch from the old version (*note Branches::.).  To do this, visit the
  352. file and type `C-u C-x C-q VERSION RET'.  (This works only with RCS.)
  353.  
  354.    If you want only to examine an old version, without changing your
  355. work file, visit the file and then type `C-x v ~ VERSION RET'
  356. (`vc-version-other-window').  This puts the text of version VERSION in
  357. a file named `FILENAME.~VERSION~', and visits it in its own buffer in a
  358. separate window.
  359.  
  360.    To compare two versions of a file, use the command `C-x v ='
  361. (`vc-diff').  Plain `C-x v =' compares the current buffer contents
  362. (saving them in the file if necessary) with the last checked-in version
  363. of the file.  `C-u C-x v =', with a numeric argument, reads a file name
  364. and two version numbers, then compares those versions of the specified
  365. file.
  366.  
  367.    If you supply a directory name instead of the name of a work file,
  368. this command compares the two specified versions of all registered files
  369. in that directory and its subdirectories.  You can also specify a
  370. snapshot name (*note Snapshots::.) instead of one or both version
  371. numbers.
  372.  
  373.    You can specify a checked-in version by its number; an empty input
  374. specifies the current contents of the work file (which may be different
  375. from all the checked-in versions).
  376.  
  377.    This command works by running the `diff' utility, getting the
  378. options from the variable `diff-switches'.  It displays the output in a
  379. special buffer in another window.  Unlike the `M-x diff' command, `C-x
  380. v =' does not try to locate the changes in the old and new versions.
  381. This is because normally one or both versions do not exist as files
  382. when you compare them; they exist only in the records of the master
  383. file.  *Note Comparing Files::, for more information about `M-x diff'.
  384.  
  385. 
  386. File: emacs,  Node: Branches,  Next: Status in VC,  Prev: Old Versions,  Up: Version Control
  387.  
  388. Multiple Branches of a File
  389. ---------------------------
  390.  
  391.    One use of version control is to maintain multiple "current"
  392. versions of a file.  For example, you might have different versions of a
  393. program in which you are gradually adding various unfinished new
  394. features.  Each such independent line of development is called a
  395. "branch".  VC allows you to create branches, and switch between
  396. existing branches.  Note, however, that branches are supported only with
  397. RCS.
  398.  
  399.    A file's main line of development is usually called the "trunk".
  400. The versions on the trunk are normally numbered 1.1, 1.2, 1.3, etc.  At
  401. any such version, you may start an independent branch.  A branch
  402. starting at version 1.2 would have version number 1.2.1.1.  Consecutive
  403. versions on this branch would have numbers 1.2.1.2, 1.2.1.3, 1.2.1.4,
  404. and so on.  If there is a second branch also starting at version 1.2; it
  405. would consist of versions 1.2.2.1, 1.2.2.2, 1.2.2.3, and so on.
  406.  
  407.    If you omit the final component of a version number, that is called a
  408. "branch number".  It refers to the highest existing version on that
  409. branch.  The branches in the example above have branch numbers 1.2.1 and
  410. 1.2.2.
  411.  
  412.    A version which is the last in its branch is called a "head" version.
  413.  
  414. * Menu:
  415.  
  416. * Switching Branches::    How to get to another existing branch.
  417. * Creating Branches::     How to start a new branch.
  418. * Multi-User Branching::  Multiple users working at multiple branches
  419.                             in parallel.
  420.  
  421. 
  422. File: emacs,  Node: Switching Branches,  Next: Creating Branches,  Up: Branches
  423.  
  424. Switching between Branches
  425. ..........................
  426.  
  427.    To switch between branches, type `C-u C-x C-q' and specify the
  428. version number you want to select.  This version is then checked out
  429. *unlocked* (write-protected), so you can examine it before really
  430. checking it out.  Switching branches in this way is allowed only when
  431. the file is not locked.
  432.  
  433.    You may omit the minor version number, thus giving only the branch
  434. number; this takes you to the highest version on the indicated branch.
  435. If you only type `RET', Emacs goes to the highest version on the trunk.
  436.  
  437.    After you have switched to any branch (including the main branch),
  438. you stay on it for subsequent VC commands, until you explicitly select
  439. some other branch.
  440.  
  441. 
  442. File: emacs,  Node: Creating Branches,  Next: Multi-User Branching,  Prev: Switching Branches,  Up: Branches
  443.  
  444. Creating New Branches
  445. .....................
  446.  
  447.    To create a new branch from a head version (one that is the latest in
  448. the branch that contains it), first select that version if necessary,
  449. lock it with `C-x C-q', and make whatever changes you want.  Then, when
  450. you check in the changes, use `C-u C-x C-q'.  This lets you specify the
  451. version number for the new version.  You should specify a suitable
  452. branch number for a branch starting at the current version.  For
  453. example, if the current version is 2.5, the branch number should be
  454. 2.5.1, 2.5.2, and so on, depending on the number of existing branches at
  455. that point.
  456.  
  457.    To create a new branch at an older version (one that is no longer the
  458. head of a branch), first select that version, lock it with `C-x C-q',
  459. and make your changes.  Then type `C-x C-q' again to check in a new
  460. version.  This automatically creates a new branch starting from the
  461. selected version.  You need not specially request a new branch, because
  462. that's the only way to add a new version at a point that is not the
  463. head of a branch.
  464.  
  465.    After the branch is created, you "stay" on it.  That means that
  466. subsequent checkouts and checkins create new versions on that branch.
  467. To leave the branch, you must explicitly select a different version with
  468. `C-u C-x C-q' for checkout.
  469.  
  470. 
  471. File: emacs,  Node: Multi-User Branching,  Prev: Creating Branches,  Up: Branches
  472.  
  473. Multi-User Branching
  474. ....................
  475.  
  476.    It is sometimes useful for multiple developers to work simultaneously
  477. on different branches of a file.  This is possible if you create
  478. multiple source directories.  Each source directory should have a link
  479. named `RCS' which points to a common directory of RCS master files.
  480. Then each source directory can have its own choice of versions checked
  481. out, but all share the same common RCS records.
  482.  
  483.    This technique works reliably and automatically, provided that the
  484. source files contain RCS version headers (*note Version Headers::.).
  485. The headers enable Emacs to be sure, at all times, which version number
  486. is present in the work file.
  487.  
  488.    If the files do not have version headers, you must instead tell Emacs
  489. explicitly in each session which branch you are working on.  To do this,
  490. first find the file, then type `C-u C-x C-q' and specify the correct
  491. branch number.  This ensures that Emacs knows which branch it is using
  492. during this particular editing session.
  493.  
  494. 
  495. File: emacs,  Node: Status in VC,  Next: Renaming and VC,  Prev: Branches,  Up: Version Control
  496.  
  497. VC Status Commands
  498. ------------------
  499.  
  500.    To view the detailed version control status and history of a file,
  501. type `C-x v l' (`vc-print-log').  It displays the history of changes to
  502. the current file, including the text of the log entries.  The output
  503. appears in a separate window.
  504.  
  505.    When you are working on a large program, it's often useful to find
  506. all the files that are currently locked, or all the files maintained in
  507. version control at all.  You can use `C-x v d' (`vc-directory') to show
  508. all the locked files in or beneath the current directory.  This
  509. includes all files that are locked by any user.  `C-u C-x v d' lists
  510. all files in or beneath the current directory that are maintained with
  511. version control.
  512.  
  513.    The list of files is displayed as a buffer that uses an augmented
  514. Dired mode.  The names of the users locking various files are shown (in
  515. parentheses) in place of the owner and group.  All the normal Dired
  516. commands work in this buffer.  Most interactive VC commands work also,
  517. and apply to the file name on the current line.
  518.  
  519.    The `C-x v v' command (`vc-next-action'), when used in the augmented
  520. Dired buffer, operates on all the marked files (or the file on the
  521. current line).  If it operates on more than one file, it handles each
  522. file according to its current state; thus, it may check out one file
  523. and check in another (because it is already checked out).  If it has to
  524. check in any files, it reads a single log entry, then uses that text
  525. for all the files being checked in.  This can be convenient for
  526. registering or checking in several files at once, as part of the same
  527. change.
  528.  
  529. 
  530. File: emacs,  Node: Renaming and VC,  Next: Snapshots,  Prev: Status in VC,  Up: Version Control
  531.  
  532. Renaming VC Work Files and Master Files
  533. ---------------------------------------
  534.  
  535.    When you rename a registered file, you must also rename its master
  536. file correspondingly to get proper results.  Use `vc-rename-file' to
  537. rename the source file as you specify, and rename its master file
  538. accordingly.  It also updates any snapshots (*note Snapshots::.) that
  539. mention the file, so that they use the new name; despite this, the
  540. snapshot thus modified may not completely work (*note Snapshot
  541. Caveats::.).
  542.  
  543.    You cannot use `vc-rename-file' on a file that is locked by someone
  544. else.
  545.  
  546. 
  547. File: emacs,  Node: Snapshots,  Next: Version Headers,  Prev: Renaming and VC,  Up: Version Control
  548.  
  549. Snapshots
  550. ---------
  551.  
  552.    A "snapshot" is a named set of file versions (one for each
  553. registered file) that you can treat as a unit.  One important kind of
  554. snapshot is a "release", a (theoretically) stable version of the system
  555. that is ready for distribution to users.
  556.  
  557. * Menu:
  558.  
  559. * Making Snapshots::        The snapshot facilities.
  560. * Snapshot Caveats::        Things to be careful of when using snapshots.
  561.  
  562. 
  563. File: emacs,  Node: Making Snapshots,  Next: Snapshot Caveats,  Up: Snapshots
  564.  
  565. Making and Using Snapshots
  566. ..........................
  567.  
  568.    There are two basic commands for snapshots; one makes a snapshot
  569. with a given name, the other retrieves a named snapshot.
  570.  
  571. `C-x v s NAME RET'
  572.      Define the last saved versions of every registered file in or
  573.      under the current directory as a snapshot named NAME
  574.      (`vc-create-snapshot').
  575.  
  576. `C-x v r NAME RET'
  577.      Check out all registered files at or below the current directory
  578.      level using whatever versions correspond to the snapshot NAME
  579.      (`vc-retrieve-snapshot').
  580.  
  581.      This command reports an error if any files are locked at or below
  582.      the current directory, without changing anything; this is to avoid
  583.      overwriting work in progress.
  584.  
  585.    A snapshot uses a very small amount of resources--just enough to
  586. record the list of file names and which version belongs to the
  587. snapshot.  Thus, you need not hesitate to create snapshots whenever
  588. they are useful.
  589.  
  590.    You can give a snapshot name as an argument to `C-x v =' or `C-x v
  591. ~' (*note Old Versions::.).  Thus, you can use it to compare a snapshot
  592. against the current files, or two snapshots against each other, or a
  593. snapshot against a named version.
  594.  
  595. 
  596. File: emacs,  Node: Snapshot Caveats,  Prev: Making Snapshots,  Up: Snapshots
  597.  
  598. Snapshot Caveats
  599. ................
  600.  
  601.    VC's snapshot facilities are modeled on RCS's named-configuration
  602. support.  They use RCS's native facilities for this, so under VC
  603. snapshots made using RCS are visible even when you bypass VC.
  604.  
  605.    For SCCS, VC implements snapshots itself.  The files it uses contain
  606. name/file/version-number triples.  These snapshots are visible only
  607. through VC.
  608.  
  609.    A snapshot is a set of checked-in versions.  So make sure that all
  610. the files are checked in and not locked when you make a snapshot.
  611.  
  612.    File renaming and deletion can create some difficulties with
  613. snapshots.  This is not a VC-specific problem, but a general design
  614. issue in version control systems that no one has solved very well yet.
  615.  
  616.    If you rename a registered file, you need to rename its master along
  617. with it (the command `vc-rename-file' does this automatically).  If you
  618. are using SCCS, you must also update the records of the snapshot, to
  619. mention the file by its new name (`vc-rename-file' does this, too).  An
  620. old snapshot that refers to a master file that no longer exists under
  621. the recorded name is invalid; VC can no longer retrieve it.  It would
  622. be beyond the scope of this manual to explain enough about RCS and SCCS
  623. to explain how to update the snapshots by hand.
  624.  
  625.    Using `vc-rename-file' makes the snapshot remain valid for
  626. retrieval, but it does not solve all problems.  For example, some of the
  627. files in the program probably refer to others by name.  At the very
  628. least, the makefile probably mentions the file that you renamed.  If you
  629. retrieve an old snapshot, the renamed file is retrieved under its new
  630. name, which is not the name that the makefile expects.  So the program
  631. won't really work as retrieved.
  632.  
  633. 
  634. File: emacs,  Node: Version Headers,  Next: Customizing VC,  Prev: Snapshots,  Up: Version Control
  635.  
  636. Inserting Version Control Headers
  637. ---------------------------------
  638.  
  639.    Sometimes it is convenient to put version identification strings
  640. directly into working files.  Certain special strings called "version
  641. headers" are replaced in each successive version by the number of that
  642. version.
  643.  
  644.    If you are using RCS, and version headers are present in your working
  645. files, Emacs can use them to determine the current version and the
  646. locking state of the files.  This is more reliable than referring to the
  647. master files, which is done when there are no version headers.  Note
  648. that in a multi-branch environment, version headers are necessary to
  649. make VC behave correctly (*note Multi-User Branching::.).
  650.  
  651.    Searching for version headers is controlled by the variable
  652. `vc-consult-headers'.  If it is non-`nil', Emacs searches for headers
  653. to determine the version number you are editing.  Setting it to `nil'
  654. disables this feature.
  655.  
  656.    You can use the `C-x v h' command (`vc-insert-headers') to insert a
  657. suitable header string.
  658.  
  659. `C-x v h'
  660.      Insert headers in a file for use with your version-control system.
  661.  
  662.    The default header string is `$Id$' for RCS and `%W%' for SCCS.  You
  663. can specify other headers to insert by setting the variable
  664. `vc-header-alist'.  Its value is a list of elements of the form
  665. `(PROGRAM . STRING)' where PROGRAM is `RCS' or `SCCS' and STRING is the
  666. string to use.
  667.  
  668.    Instead of a single string, you can specify a list of strings; then
  669. each string in the list is inserted as a separate header on a line of
  670. its own.
  671.  
  672.    It is often necessary to use "superfluous" backslashes when writing
  673. the strings that you put in this variable.  This is to prevent the
  674. string in the constant from being interpreted as a header itself if the
  675. Emacs Lisp file containing it is maintained with version control.
  676.  
  677.    Each header is inserted surrounded by tabs, inside comment
  678. delimiters, on a new line at the start of the buffer.  Normally the
  679. ordinary comment start and comment end strings of the current mode are
  680. used, but for certain modes, there are special comment delimiters for
  681. this purpose; the variable `vc-comment-alist' specifies them.  Each
  682. element of this list has the form `(MODE STARTER ENDER)'.
  683.  
  684.    The variable `vc-static-header-alist' specifies further strings to
  685. add based on the name of the buffer.  Its value should be a list of
  686. elements of the form `(REGEXP . FORMAT)'.  Whenever REGEXP matches the
  687. buffer name, FORMAT is inserted as part of the header.  A header line
  688. is inserted for each element that matches the buffer name, and for each
  689. string specified by `vc-header-alist'.  The header line is made by
  690. processing the string from `vc-header-alist' with the format taken from
  691. the element.  The default value for `vc-static-header-alist' is as
  692. follows:
  693.  
  694.      (("\\.c$" .
  695.        "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
  696.      #endif /* lint */\n"))
  697.  
  698. It specifies insertion of text of this form:
  699.  
  700.  
  701.      #ifndef lint
  702.      static char vcid[] = "STRING";
  703.      #endif /* lint */
  704.  
  705. Note that the text above starts with a blank line.
  706.  
  707.    If you use more than one version header in a file, put them close
  708. together in the file.  The mechanism in `revert-buffer' that preserves
  709. markers may not handle markers positioned between two version headers.
  710.  
  711. 
  712. File: emacs,  Node: Customizing VC,  Prev: Version Headers,  Up: Version Control
  713.  
  714. Customizing VC
  715. --------------
  716.  
  717.    Emacs normally does not save backup files for source files that are
  718. maintained with version control.  If you want to make backup files even
  719. for files that use version control, set the variable
  720. `vc-make-backup-files' to a non-`nil' value.
  721.  
  722.    Normally the work file exists all the time, whether it is locked or
  723. not.  If you set `vc-keep-workfiles' to `nil', then checking in a new
  724. version with `C-x C-q' deletes the work file; but any attempt to visit
  725. the file with Emacs creates it again.  (With CVS, work files are always
  726. kept.)
  727.  
  728.    If `vc-suppress-confirm' is non-`nil', then `C-x C-q' and `C-x v i'
  729. can save the current buffer without asking, and `C-x v u' also operates
  730. without asking for confirmation.  (This variable does not affect `C-x v
  731. c'; that operation is so drastic that it should always ask for
  732. confirmation.)
  733.  
  734.    VC mode does much of its work by running the shell commands for RCS,
  735. CVS and SCCS.  If `vc-command-messages' is non-`nil', VC displays
  736. messages to indicate which shell commands it runs, and additional
  737. messages when the commands finish.
  738.  
  739.    When deducing the locked/unlocked state of a file, VC first looks for
  740. an RCS version header string in the file (*note Version Headers::.).  If
  741. there is no header string (or if the backend system is SCCS), VC
  742. normally looks at the file permissions of the work file; this is fast.
  743. But there might be situations when the file permissions cannot be
  744. trusted.  In this case the master file has to be consulted, which is
  745. rather expensive.  Also the master file can only tell you *if* there's
  746. any lock on the file, but not whether your work file really contains
  747. that locked version.
  748.  
  749.    You can tell VC not to use version headers to determine lock status
  750. by setting `vc-consult-headers' to `nil'.  VC then always uses the file
  751. permissions (if it can trust them), or else checks the master file.
  752.  
  753.    You can specify the criterion for whether to trust the file
  754. permissions by setting the variable `vc-mistrust-permissions'.  Its
  755. value may be `t' (always mistrust the file permissions and check the
  756. master file), `nil' (always trust the file permissions), or a function
  757. of one argument which makes the decision.  The argument is the
  758. directory name of the `RCS', `CVS' or `SCCS' subdirectory.  A non-`nil'
  759. value from the function says to mistrust the file permissions.  If you
  760. find that the file permissions of work files are changed erroneously,
  761. set `vc-mistrust-permissions' to `t'.  Then VC always checks the master
  762. file to determine the file's status.
  763.  
  764.    You can specify additional directories to search for version control
  765. programs by setting the variable `vc-path'.  These directories are
  766. searched before the usual search path.  But the proper files are usually
  767. found automatically.
  768.  
  769. 
  770. File: emacs,  Node: Directories,  Next: Comparing Files,  Prev: Version Control,  Up: Files
  771.  
  772. File Directories
  773. ================
  774.  
  775.    The file system groups files into "directories".  A "directory
  776. listing" is a list of all the files in a directory.  Emacs provides
  777. commands to create and delete directories, and to make directory
  778. listings in brief format (file names only) and verbose format (sizes,
  779. dates, and authors included).  There is also a directory browser called
  780. Dired; see *Note Dired::.
  781.  
  782. `C-x C-d DIR-OR-PATTERN RET'
  783.      Display a brief directory listing (`list-directory').
  784.  
  785. `C-u C-x C-d DIR-OR-PATTERN RET'
  786.      Display a verbose directory listing.
  787.  
  788. `M-x make-directory RET DIRNAME RET'
  789.      Create a new directory named DIRNAME.
  790.  
  791. `M-x delete-directory RET DIRNAME RET'
  792.      Delete the directory named DIRNAME.  It must be empty, or you get
  793.      an error.
  794.  
  795.    The command to display a directory listing is `C-x C-d'
  796. (`list-directory').  It reads using the minibuffer a file name which is
  797. either a directory to be listed or a wildcard-containing pattern for
  798. the files to be listed.  For example,
  799.  
  800.      C-x C-d /u2/emacs/etc RET
  801.  
  802. lists all the files in directory `/u2/emacs/etc'.  Here is an example
  803. of specifying a file name pattern:
  804.  
  805.      C-x C-d /u2/emacs/src/*.c RET
  806.  
  807.    Normally, `C-x C-d' prints a brief directory listing containing just
  808. file names.  A numeric argument (regardless of value) tells it to make
  809. a verbose listing including sizes, dates, and authors (like `ls -l').
  810.  
  811.    The text of a directory listing is obtained by running `ls' in an
  812. inferior process.  Two Emacs variables control the switches passed to
  813. `ls': `list-directory-brief-switches' is a string giving the switches
  814. to use in brief listings (`"-CF"' by default), and
  815. `list-directory-verbose-switches' is a string giving the switches to
  816. use in a verbose listing (`"-l"' by default).
  817.  
  818. 
  819. File: emacs,  Node: Comparing Files,  Next: Misc File Ops,  Prev: Directories,  Up: Files
  820.  
  821. Comparing Files
  822. ===============
  823.  
  824.    The command `M-x diff' compares two files, displaying the
  825. differences in an Emacs buffer named `*Diff*'.  It works by running the
  826. `diff' program, using options taken from the variable `diff-switches',
  827. whose value should be a string.
  828.  
  829.    The buffer `*Diff*' has Compilation mode as its major mode, so you
  830. can use `C-x `' to visit successive changed locations in the two source
  831. files.  You can also move to a particular hunk of changes and type RET
  832. or `C-c C-c', or click `Mouse-2' on it, to move to the corresponding
  833. source location.  You can also use the other special commands of
  834. Compilation mode: SPC and DEL for scrolling, and `M-p' and `M-n' for
  835. cursor motion.  *Note Compilation::.
  836.  
  837.    The command `M-x diff-backup' compares a specified file with its most
  838. recent backup.  If you specify the name of a backup file, `diff-backup'
  839. compares it with the source file that it is a backup of.
  840.  
  841.    The command `M-x compare-windows' compares the text in the current
  842. window with that in the next window.  Comparison starts at point in each
  843. window, and each starting position is pushed on the mark ring in its
  844. respective buffer.  Then point moves forward in each window, a character
  845. at a time, until a mismatch between the two windows is reached.  Then
  846. the command is finished.  For more information about windows in Emacs,
  847. *Note Windows::.
  848.  
  849.    With a numeric argument, `compare-windows' ignores changes in
  850. whitespace.  If the variable `compare-ignore-case' is non-`nil', it
  851. ignores differences in case as well.
  852.  
  853.    See also *Note Emerge::, for convenient facilities for merging two
  854. similar files.
  855.  
  856. 
  857. File: emacs,  Node: Misc File Ops,  Prev: Comparing Files,  Up: Files
  858.  
  859. Miscellaneous File Operations
  860. =============================
  861.  
  862.    Emacs has commands for performing many other operations on files.
  863. All operate on one file; they do not accept wild card file names.
  864.  
  865.    `M-x view-file' allows you to scan or read a file by sequential
  866. screenfuls.  It reads a file name argument using the minibuffer.  After
  867. reading the file into an Emacs buffer, `view-file' displays the
  868. beginning.  You can then type SPC to scroll forward one windowful, or
  869. DEL to scroll backward.  Various other commands are provided for moving
  870. around in the file, but none for changing it; type `C-h' while viewing
  871. for a list of them.  They are mostly the same as normal Emacs cursor
  872. motion commands.  To exit from viewing, type `C-c'.  The commands for
  873. viewing are defined by a special major mode called View mode.
  874.  
  875.    A related command, `M-x view-buffer', views a buffer already present
  876. in Emacs.  *Note Misc Buffer::.
  877.  
  878.    `M-x insert-file' inserts a copy of the contents of the specified
  879. file into the current buffer at point, leaving point unchanged before
  880. the contents and the mark after them.
  881.  
  882.    `M-x write-region' is the inverse of `M-x insert-file'; it copies
  883. the contents of the region into the specified file.  `M-x
  884. append-to-file' adds the text of the region to the end of the specified
  885. file.  *Note Accumulating Text::.
  886.  
  887.    `M-x delete-file' deletes the specified file, like the `rm' command
  888. in the shell.  If you are deleting many files in one directory, it may
  889. be more convenient to use Dired (*note Dired::.).
  890.  
  891.    `M-x rename-file' reads two file names OLD and NEW using the
  892. minibuffer, then renames file OLD as NEW.  If a file named NEW already
  893. exists, you must confirm with `yes' or renaming is not done; this is
  894. because renaming causes the old meaning of the name NEW to be lost.  If
  895. OLD and NEW are on different file systems, the file OLD is copied and
  896. deleted.
  897.  
  898.    The similar command `M-x add-name-to-file' is used to add an
  899. additional name to an existing file without removing its old name.  The
  900. new name must belong on the same file system that the file is on.
  901.  
  902.    `M-x copy-file' reads the file OLD and writes a new file named NEW
  903. with the same contents.  Confirmation is required if a file named NEW
  904. already exists, because copying has the consequence of overwriting the
  905. old contents of the file NEW.
  906.  
  907.    `M-x make-symbolic-link' reads two file names OLD and LINKNAME, then
  908. creates a symbolic link named LINKNAME and pointing at OLD.  The effect
  909. is that future attempts to open file LINKNAME will refer to whatever
  910. file is named OLD at the time the opening is done, or will get an error
  911. if the name OLD is not in use at that time.  This command does not
  912. expand the argument FILENAME, so that it allows you to specify a
  913. relative name as the target of the link.
  914.  
  915.    Confirmation is required when creating the link if LINKNAME is in
  916. use.  Note that not all systems support symbolic links.
  917.  
  918. 
  919. File: emacs,  Node: Buffers,  Next: Windows,  Prev: Files,  Up: Top
  920.  
  921. Using Multiple Buffers
  922. **********************
  923.  
  924.    The text you are editing in Emacs resides in an object called a
  925. "buffer".  Each time you visit a file, a buffer is created to hold the
  926. file's text.  Each time you invoke Dired, a buffer is created to hold
  927. the directory listing.  If you send a message with `C-x m', a buffer
  928. named `*mail*' is used to hold the text of the message.  When you ask
  929. for a command's documentation, that appears in a buffer called `*Help*'.
  930.  
  931.    At any time, one and only one buffer is "selected".  It is also
  932. called the "current buffer".  Often we say that a command operates on
  933. "the buffer" as if there were only one; but really this means that the
  934. command operates on the selected buffer (most commands do).
  935.  
  936.    When Emacs has multiple windows, each window has a chosen buffer
  937. which is displayed there, but at any time only one of the windows is
  938. selected and its chosen buffer is the selected buffer.  Each window's
  939. mode line displays the name of the buffer that the window is displaying
  940. (*note Windows::.).
  941.  
  942.    Each buffer has a name, which can be of any length, and you can
  943. select any buffer by giving its name.  Most buffers are made by
  944. visiting files, and their names are derived from the files' names.  But
  945. you can also create an empty buffer with any name you want.  A newly
  946. started Emacs has a buffer named `*scratch*' which can be used for
  947. evaluating Lisp expressions in Emacs.  The distinction between upper
  948. and lower case matters in buffer names.
  949.  
  950.    Each buffer records individually what file it is visiting, whether
  951. it is modified, and what major mode and minor modes are in effect in it
  952. (*note Major Modes::.).  Any Emacs variable can be made "local to" a
  953. particular buffer, meaning its value in that buffer can be different
  954. from the value in other buffers.  *Note Locals::.
  955.  
  956. * Menu:
  957.  
  958. * Select Buffer::      Creating a new buffer or reselecting an old one.
  959. * List Buffers::       Getting a list of buffers that exist.
  960. * Misc Buffer::           Renaming; changing read-onliness; copying text.
  961. * Kill Buffer::           Killing buffers you no longer need.
  962. * Several Buffers::    How to go through the list of all buffers
  963.              and operate variously on several of them.
  964. * Indirect Buffers::   An indirect buffer shares the text of another buffer.
  965.  
  966. 
  967. File: emacs,  Node: Select Buffer,  Next: List Buffers,  Up: Buffers
  968.  
  969. Creating and Selecting Buffers
  970. ==============================
  971.  
  972. `C-x b BUFFER RET'
  973.      Select or create a buffer named BUFFER (`switch-to-buffer').
  974.  
  975. `C-x 4 b BUFFER RET'
  976.      Similar, but select BUFFER in another window
  977.      (`switch-to-buffer-other-window').
  978.  
  979. `C-x 5 b BUFFER RET'
  980.      Similar, but select BUFFER in a separate frame
  981.      (`switch-to-buffer-other-frame').
  982.  
  983.    To select the buffer named BUFNAME, type `C-x b BUFNAME RET'.  This
  984. runs the command `switch-to-buffer' with argument BUFNAME.  You can use
  985. completion on an abbreviation for the buffer name you want (*note
  986. Completion::.).  An empty argument to `C-x b' specifies the most
  987. recently selected buffer that is not displayed in any window.
  988.  
  989.    Most buffers are created by visiting files, or by Emacs commands that
  990. want to display some text, but you can also create a buffer explicitly
  991. by typing `C-x b BUFNAME RET'.  This makes a new, empty buffer which is
  992. not visiting any file, and selects it for editing.  Such buffers are
  993. used for making notes to yourself.  If you try to save one, you are
  994. asked for the file name to use.  The new buffer's major mode is
  995. determined by the value of `default-major-mode' (*note Major Modes::.).
  996.  
  997.    Note that `C-x C-f', and any other command for visiting a file, can
  998. also be used to switch to an existing file-visiting buffer.  *Note
  999. Visiting::.
  1000.  
  1001. 
  1002. File: emacs,  Node: List Buffers,  Next: Misc Buffer,  Prev: Select Buffer,  Up: Buffers
  1003.  
  1004. Listing Existing Buffers
  1005. ========================
  1006.  
  1007. `C-x C-b'
  1008.      List the existing buffers (`list-buffers').
  1009.  
  1010.    To display a list of all the buffers that exist, type `C-x C-b'.
  1011. Each line in the list shows one buffer's name, major mode and visited
  1012. file.  The buffers are listed in the order, most recently visited first.
  1013.  
  1014.    `*' at the beginning of a line indicates the buffer is "modified".
  1015. If several buffers are modified, it may be time to save some with `C-x
  1016. s' (*note Saving::.).  `%' indicates a read-only buffer.  `.' marks the
  1017. selected buffer.  Here is an example of a buffer list:
  1018.  
  1019.       MR Buffer         Size  Mode           File
  1020.       -- ------         ----  ----           ----
  1021.      .*  emacs.tex      383402 Texinfo       /u2/emacs/man/emacs.tex
  1022.          *Help*         1287  Fundamental
  1023.          files.el       23076 Emacs-Lisp     /u2/emacs/lisp/files.el
  1024.        % RMAIL          64042 RMAIL          /u/rms/RMAIL
  1025.       *% man            747   Dired          /u2/emacs/man/
  1026.          net.emacs      343885 Fundamental   /u/rms/net.emacs
  1027.          fileio.c       27691 C              /u2/emacs/src/fileio.c
  1028.          NEWS           67340 Text           /u2/emacs/etc/NEWS
  1029.          *scratch*       0     Lisp Interaction
  1030.  
  1031. Note that the buffer `*Help*' was made by a help request; it is not
  1032. visiting any file.  The buffer `man' was made by Dired on the directory
  1033. `/u2/emacs/man/'.
  1034.  
  1035. 
  1036. File: emacs,  Node: Misc Buffer,  Next: Kill Buffer,  Prev: List Buffers,  Up: Buffers
  1037.  
  1038. Miscellaneous Buffer Operations
  1039. ===============================
  1040.  
  1041. `C-x C-q'
  1042.      Toggle read-only status of buffer (`vc-toggle-read-only').
  1043.  
  1044. `M-x rename-buffer RET NAME RET'
  1045.      Change the name of the current buffer.
  1046.  
  1047. `M-x rename-uniquely'
  1048.      Rename the current buffer by adding `<NUMBER>' to the end.
  1049.  
  1050. `M-x view-buffer RET BUFFER RET'
  1051.      Scroll through buffer BUFFER.
  1052.  
  1053.    A buffer can be "read-only", which means that commands to change its
  1054. contents are not allowed.  The mode line indicates read-only buffers
  1055. with `%%' or `%*' near the left margin.  Read-only buffers are usually
  1056. made by subsystems such as Dired and Rmail that have special commands
  1057. to operate on the text; also by visiting a file whose access control
  1058. says you cannot write it.
  1059.  
  1060.    If you wish to make changes in a read-only buffer, use the command
  1061. `C-x C-q' (`vc-toggle-read-only').  It makes a read-only buffer
  1062. writable, and makes a writable buffer read-only.  In most cases, this
  1063. works by setting the variable `buffer-read-only', which has a local
  1064. value in each buffer and makes the buffer read-only if its value is
  1065. non-`nil'.  If the file is maintained with version control, `C-x C-q'
  1066. works through the version control system to change the read-only status
  1067. of the file as well as the buffer.  *Note Version Control::.
  1068.  
  1069.    `M-x rename-buffer' changes the name of the current buffer.  Specify
  1070. the new name as a minibuffer argument.  There is no default.  If you
  1071. specify a name that is in use for some other buffer, an error happens
  1072. and no renaming is done.
  1073.  
  1074.    `M-x rename-uniquely' renames the current buffer to a similar name
  1075. with a numeric suffix added to make it both different and unique.  This
  1076. command does not need an argument.  It is useful for creating multiple
  1077. shell buffers: if you rename the `*Shell*' buffer, then do `M-x shell'
  1078. again, it makes a new shell buffer named `*Shell*'; meanwhile, the old
  1079. shell buffer continues to exist under its new name.  This method is
  1080. also good for mail buffers, compilation buffers, and most Emacs
  1081. features that create special buffers with particular names.
  1082.  
  1083.    `M-x view-buffer' is much like `M-x view-file' (*note Misc File
  1084. Ops::.) except that it examines an already existing Emacs buffer.  View
  1085. mode provides commands for scrolling through the buffer conveniently
  1086. but not for changing it.  When you exit View mode, the value of point
  1087. that resulted from your perusal remains in effect.
  1088.  
  1089.    The commands `M-x append-to-buffer' and `M-x insert-buffer' can be
  1090. used to copy text from one buffer to another.  *Note Accumulating
  1091. Text::.
  1092.  
  1093. 
  1094. File: emacs,  Node: Kill Buffer,  Next: Several Buffers,  Prev: Misc Buffer,  Up: Buffers
  1095.  
  1096. Killing Buffers
  1097. ===============
  1098.  
  1099.    If you continue an Emacs session for a while, you may accumulate a
  1100. large number of buffers.  You may then find it convenient to "kill" the
  1101. buffers you no longer need.  On most operating systems, killing a
  1102. buffer releases its space back to the operating system so that other
  1103. programs can use it.  Here are some commands for killing buffers:
  1104.  
  1105. `C-x k BUFNAME RET'
  1106.      Kill buffer BUFNAME (`kill-buffer').
  1107.  
  1108. `M-x kill-some-buffers'
  1109.      Offer to kill each buffer, one by one.
  1110.  
  1111.    `C-x k' (`kill-buffer') kills one buffer, whose name you specify in
  1112. the minibuffer.  The default, used if you type just RET in the
  1113. minibuffer, is to kill the current buffer.  If you kill the current
  1114. buffer, another buffer is selected; one that has been selected recently
  1115. but does not appear in any window now.  If you ask to kill a
  1116. file-visiting buffer that is modified (has unsaved editing), then you
  1117. must confirm with `yes' before the buffer is killed.
  1118.  
  1119.    The command `M-x kill-some-buffers' asks about each buffer, one by
  1120. one.  An answer of `y' means to kill the buffer.  Killing the current
  1121. buffer or a buffer containing unsaved changes selects a new buffer or
  1122. asks for confirmation just like `kill-buffer'.
  1123.  
  1124.    The buffer menu feature (*note Several Buffers::.) is also convenient
  1125. for killing various buffers.
  1126.  
  1127.    If you want to do something special every time a buffer is killed,
  1128. you can add hook functions to the hook `kill-buffer-hook' (*note
  1129. Hooks::.).
  1130.  
  1131.